import Vue from 'vue'
import VueRouter from 'vue-router'

import Login from '@/views/Auth/login'
import Register from '@/views/Auth/register'
import Home from '@/views/home'
import Test from '@/views/test'

import Mycenter from '@/views/project/Mycenter'
import Edit from '@/views/project/edit'
import Attention from '@/views/project/attention'
import Reply from '@/views/project/reply'
import Collect from '@/views/project/collect'
import Setting from '@/views/project/setting'

import WriteText from '@/components/writeText.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    component: Home
  },
  {
    path: '/login',
    name: 'login',
    component: Login
  },
  {
    path: '/register',
    name: 'register',
    component: Register
  },
  {
    path: '/mycenter',
    name: 'Mycenter',
    component: Mycenter,
    // meta属性可以用于判断是否要验证token
    meta: {
      isToken: true
    }
  },
  {
    path: '/edit',
    name: 'edit',
    component: Edit,
    meta: {
      isToken: true
    }
  },
  {
    path: '/writeText',
    name: 'writeText',
    component: WriteText
  },
  {
    path: '/attention',
    name: 'attention',
    component: Attention
  },
  {
    path: '/reply',
    name: 'reply',
    component: Reply
  },
  {
    path: '/collect',
    name: 'collect',
    component: Collect
  },
  {
    path: '/setting',
    name: 'setting',
    component: Setting
  },
  {
    path: '/test',
    name: 'test',
    component: Test
  }
]

const router = new VueRouter({
  routes
})

export default router
